package com.shujia.base;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

import java.io.IOException;

public class Code01HbaseCon {
    public static void main(String[] args) throws IOException {

        // 创建连接需要给定连接信息，所以需要给定配置类
        Configuration conf = new Configuration();

        // 由于对HBASE进行操作时，需要连接其Zookeeper 那么需要传入Zookeeper的IP
        conf.set("hbase.zookeeper.quorum","node1,node2,master");

        // 获取连接对象 通过ConnectionFactory来创建连接对象
        Connection connection = ConnectionFactory.createConnection(conf);

        System.out.println(connection.getClass().getName());


        // 关闭

        connection.close();

    }
}
